package com.example.dailyrecord.base.service;

import com.example.dailyrecord.base.entity.Page;
import com.example.dailyrecord.base.entity.SQLBuilder;
import com.example.dailyrecord.entity.StatusCode;
import com.github.pagehelper.PageInfo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.List;

public interface BaseService<T> {
    String getEmail(HttpServletRequest request);

    StatusCode insertRequest(HttpServletRequest request, HttpServletResponse response);

    void deleteRequest(HttpServletRequest request, HttpServletResponse response);

    T updateRequest(HttpServletRequest request, HttpServletResponse response);

    T selectRequest(HttpServletRequest request, HttpServletResponse response);

    PageInfo<T> getListRequest(HttpServletRequest request, HttpServletResponse response);

    void insert(T t);

    void delete(String key);

    void update(T key);

    T select(String key);

    PageInfo<T> getList(T t, Page page);

    void insertList(List<T> list);

    void deleteFree(SQLBuilder builder);

    void updateFree(SQLBuilder builder);

    void updateList(List<T> list);

    void updateByBuilder(T key, SQLBuilder builder);

    T selectFree(SQLBuilder builder);

    List<T> selectList(SQLBuilder builder);

    String selectStringFree(SQLBuilder builder);

    List<String> selectStringListFree(SQLBuilder builder);

    List<T> selectListFree(SQLBuilder builder);

    long countByBuilder(SQLBuilder builder);

    void truncate();

    long countRequest(HttpServletRequest request, HttpServletResponse response);
}
